<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;

class UserReward extends Model
{
    public $timestamps = false;
    protected $fillable = ['uri'];
    protected $appends = ['url'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function getUrlAttribute()
    {
        return Storage::url('user-reward/' . $this->uri) ?? false;
    }
}
